import React, {Component} from 'react';
import {Redirect, Route, Switch} from "react-router-dom";
import MyNavLink from "../../components/MyNavLink/MyNavLink";
import News from "./News/News";
import Message from "./Message/Message";

class Home extends Component {
    render() {
        return (
            <div className="col-xs-6">
                <div className="panel">
                    <div className="panel-body">
                        <div>
                            <h3>Show Context Home</h3>
                            <div>
                                <ul className="nav nav-tabs">
                                    <li>
                                        <MyNavLink to="/home/news">News</MyNavLink>
                                    </li>
                                    <li>
                                        <MyNavLink to="/home/message">Message</MyNavLink>
                                    </li>
                                </ul>
                                <Switch>
                                    <Route path="/home/news" component={News}/>
                                    <Route path="/home/message" component={Message}/>
                                    <Redirect to="/home/news"/>
                                </Switch>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        );
    }
}

export default Home;